CREATE TABLE "ADMI11"."ACHAT"
  (
    "ID_ACHAT"       NUMBER NOT NULL ENABLE,
    "ID_FOURNISSEUR" NUMBER,
    "DATE_ACHAT" DATE,
    CONSTRAINT "ACHAT_PK" PRIMARY KEY ("ID_ACHAT") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE,
    CONSTRAINT "ACHAT_FOURNISSEUR_FK1" FOREIGN KEY ("ID_FOURNISSEUR") REFERENCES "ADMI11"."FOURNISSEUR" ("ID_FOURNISSEUR") ENABLE
  )
  SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
  (
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
  )
  TABLESPACE "USERS" ;
CREATE OR REPLACE TRIGGER "ADMI11"."ACHAT_TRG" BEFORE
  INSERT ON ACHAT FOR EACH ROW BEGIN <<COLUMN_SEQUENCES>> BEGIN IF :NEW.ID_ACHAT IS NULL THEN
  SELECT ACHAT_SEQ.NEXTVAL INTO :NEW.ID_ACHAT FROM DUAL;
END IF;
END COLUMN_SEQUENCES;
END;
/
ALTER TRIGGER "ADMI11"."ACHAT_TRG" ENABLE;
  
  ----------------------
  
CREATE TABLE "ADMI11"."CLIENT"
  (
    "ID_CLIENT"          NUMBER NOT NULL ENABLE,
    "NOM_CLIENT"         VARCHAR2(30 BYTE) NOT NULL ENABLE,
    "PRENOM_CLIENT"      VARCHAR2(30 BYTE),
    "ADRESSE_CLIENT"     VARCHAR2(50 BYTE) NOT NULL ENABLE,
    "VILLE_CLIENT"       VARCHAR2(30 BYTE) NOT NULL ENABLE,
    "CODE_POSTAL_CLIENT" VARCHAR2(5 BYTE) NOT NULL ENABLE,
    "TELEPHONE_CLIENT"   VARCHAR2(10 BYTE),
    CONSTRAINT "CLIENT_PK" PRIMARY KEY ("ID_CLIENT") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE
  )
  SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
  (
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
  )
  TABLESPACE "USERS" ;
CREATE OR REPLACE TRIGGER "ADMI11"."CLIENT_TRG" BEFORE
  INSERT ON CLIENT FOR EACH ROW BEGIN <<COLUMN_SEQUENCES>> BEGIN IF :NEW.ID_CLIENT IS NULL THEN
  SELECT CLIENT_SEQ.NEXTVAL INTO :NEW.ID_CLIENT FROM DUAL;
END IF;
END COLUMN_SEQUENCES;
END;
/
ALTER TRIGGER "ADMI11"."CLIENT_TRG" ENABLE;

-----------------------

CREATE TABLE "ADMI11"."COMMANDE"
  (
    "ID_COMMANDE" NUMBER NOT NULL ENABLE,
    "ID_CLIENT"   NUMBER,
    "DATE_COMMANDE" DATE,
    CONSTRAINT "COMMANDE_PK1" PRIMARY KEY ("ID_COMMANDE") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE,
    CONSTRAINT "COMMANDE_CLIENT_FK1" FOREIGN KEY ("ID_CLIENT") REFERENCES "ADMI11"."CLIENT" ("ID_CLIENT") ENABLE
  )
  SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
  (
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
  )
  TABLESPACE "USERS" ;
CREATE OR REPLACE TRIGGER "ADMI11"."COMMANDE_TRG" BEFORE
  INSERT ON COMMANDE FOR EACH ROW BEGIN <<COLUMN_SEQUENCES>> BEGIN IF :NEW.ID_COMMANDE IS NULL THEN
  SELECT COMMANDE_SEQ.NEXTVAL INTO :NEW.ID_COMMANDE FROM DUAL;
END IF;
END COLUMN_SEQUENCES;
END;
/
ALTER TRIGGER "ADMI11"."COMMANDE_TRG" ENABLE;
  
  --------------
 
CREATE TABLE "ADMI11"."DETAIL_ACHAT"
  (
    "ID_ACHAT"       NUMBER NOT NULL ENABLE,
    "ID_PRODUIT"     NUMBER NOT NULL ENABLE,
    "QUANTITE_ACHAT" NUMBER,
    CONSTRAINT "DETAIL_ACHAT_PK" PRIMARY KEY ("ID_ACHAT", "ID_PRODUIT") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING TABLESPACE "USERS" ENABLE,
    CONSTRAINT "DETAIL_ACHAT_ACHAT_FK1" FOREIGN KEY ("ID_ACHAT") REFERENCES "ADMI11"."ACHAT" ("ID_ACHAT") ENABLE,
    CONSTRAINT "DETAIL_ACHAT_PRODUIT_FK1" FOREIGN KEY ("ID_PRODUIT") REFERENCES "ADMI11"."PRODUIT" ("ID_PRODUIT") ENABLE
  )
  SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING TABLESPACE "USERS" ;
  
  -----------------------
 
CREATE TABLE "ADMI11"."DETAIL_COMMANDE"
  (
    "ID_COMMANDE"       NUMBER NOT NULL ENABLE,
    "ID_PRODUIT"        NUMBER NOT NULL ENABLE,
    "QUANTITE_COMMANDE" NUMBER,
    CONSTRAINT "DETAIL_COMMANDE_PK" PRIMARY KEY ("ID_COMMANDE", "ID_PRODUIT") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOCOMPRESS LOGGING TABLESPACE "USERS" ENABLE,
    CONSTRAINT "DETAIL_COMMANDE_COMMANDE_FK1" FOREIGN KEY ("ID_COMMANDE") REFERENCES "ADMI11"."COMMANDE" ("ID_COMMANDE") ENABLE,
    CONSTRAINT "DETAIL_COMMANDE_PRODUIT_FK1" FOREIGN KEY ("ID_PRODUIT") REFERENCES "ADMI11"."PRODUIT" ("ID_PRODUIT") ENABLE
  )
  SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING TABLESPACE "USERS" ;
  
  ------------------------

CREATE TABLE "ADMI11"."FOURNISSEUR"
  (
    "ID_FOURNISSEUR"          NUMBER NOT NULL ENABLE,
    "NOM_FOURNISSEUR"         VARCHAR2(30 BYTE),
    "ADRESSE_FOURNISSEUR"     VARCHAR2(50 BYTE),
    "VILLE_FOURNISSEUR"       VARCHAR2(30 BYTE),
    "CODE_POSTAL_FOURNISSEUR" VARCHAR2(5 BYTE),
    "TELEPHONE_FOURNISSEUR"   VARCHAR2(10 BYTE),
    CONSTRAINT "FOURNISSEUR_PK" PRIMARY KEY ("ID_FOURNISSEUR") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE
  )
  SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
  (
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
  )
  TABLESPACE "USERS" ;
CREATE OR REPLACE TRIGGER "ADMI11"."FOURNISSEUR_TRG" BEFORE
  INSERT ON FOURNISSEUR FOR EACH ROW BEGIN <<COLUMN_SEQUENCES>> BEGIN IF :NEW.ID_FOURNISSEUR IS NULL THEN
  SELECT FOURNISSEUR_SEQ.NEXTVAL INTO :NEW.ID_FOURNISSEUR FROM DUAL;
END IF;
END COLUMN_SEQUENCES;
END;
/
ALTER TRIGGER "ADMI11"."FOURNISSEUR_TRG" ENABLE;

--------------------------------

CREATE TABLE "ADMI11"."PRODUIT"
  (
    "ID_PRODUIT"         NUMBER NOT NULL ENABLE,
    "LABEL_PRODUIT"      VARCHAR2(50 BYTE),
    "ID_FOURNISSEUR"     NUMBER,
    "CATEGORIE_PRODUIT"  VARCHAR2(30 BYTE),
    "PRIX_VENTE_PRODUIT" NUMBER(6,2),
    "PRIX_ACHAT_PRODUIT" NUMBER(6,2),
    CONSTRAINT "PRODUIT_PK" PRIMARY KEY ("ID_PRODUIT") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE,
    CONSTRAINT "PRODUIT_FOURNISSEUR_FK1" FOREIGN KEY ("ID_FOURNISSEUR") REFERENCES "ADMI11"."FOURNISSEUR" ("ID_FOURNISSEUR") ENABLE
  )
  SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
  (
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
  )
  TABLESPACE "USERS" ;
CREATE OR REPLACE TRIGGER "ADMI11"."PRODUIT_TRG" BEFORE
  INSERT ON PRODUIT FOR EACH ROW BEGIN <<COLUMN_SEQUENCES>> BEGIN IF :NEW.ID_PRODUIT IS NULL THEN
  SELECT PRODUIT_SEQ.NEXTVAL INTO :NEW.ID_PRODUIT FROM DUAL;
END IF;
END COLUMN_SEQUENCES;
END;
/
ALTER TRIGGER "ADMI11"."PRODUIT_TRG" ENABLE;

-----------------------

CREATE TABLE "ADMI11"."STOCK"
  (
    "ID_PRODUIT"       NUMBER NOT NULL ENABLE,
    "QUANTITE_PRODUIT" NUMBER NOT NULL ENABLE,
    CONSTRAINT "STOCK_PK" PRIMARY KEY ("ID_PRODUIT") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE,
    CONSTRAINT "STOCK_PRODUIT_FK1" FOREIGN KEY ("ID_PRODUIT") REFERENCES "ADMI11"."PRODUIT" ("ID_PRODUIT") ENABLE
  )
  SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
  (
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
  )
  TABLESPACE "USERS" ;
